<?php

namespace api\modules\app\models;

use Yii;

/**
 * This is the model class for table "qrcode".
 *
 * @property integer $id
 * @property string $code
 * @property string $url
 * @property integer $state
 * @property integer $has_bind
 * @property string $bind_code
 * @property string $bind_at
 * @property integer $bind_user
 * @property string $bind_username
 * @property double $bind_lng
 * @property double $bind_lat
 * @property string $bind_address
 * @property string $event_type1
 * @property string $event_type1_code
 * @property string $event_type2
 * @property string $event_type2_code
 * @property string $event_type3
 * @property string $event_type3_code
 * @property string $unit_name
 * @property string $unit_name_code
 * @property string $images
 * @property string $created_at
 * @property string $path
 * @property string $batch_code
 */
class Qrcode extends \yii\db\ActiveRecord
{
    const TAG_UNIT = 1;
    const TAG_LOCATION = 2;

    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'qrcode';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('test_3');
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['state', 'has_bind', 'bind_user'], 'integer'],
            [['bind_at', 'created_at'], 'safe'],
            [['bind_lng', 'bind_lat'], 'number'],
            [['bind_address'], 'string'],
            [['code', 'url', 'bind_code', 'bind_username', 'event_type1', 'event_type1_code', 'event_type2', 'event_type2_code', 'event_type3', 'event_type3_code', 'unit_name', 'unit_name_code', 'path', 'batch_code'], 'string', 'max' => 5000],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'code' => 'Code',
            'url' => 'Url',
            'state' => 'State',
            'has_bind' => 'Has Bind',
            'bind_code' => 'Bind Code',
            'bind_at' => 'Bind At',
            'bind_user' => 'Bind User',
            'bind_username' => 'Bind Username',
            'bind_lng' => 'Bind Lng',
            'bind_lat' => 'Bind Lat',
            'bind_address' => 'Bind Address',
            'event_type1' => 'Event Type1',
            'event_type1_code' => 'Event Type1 Code',
            'event_type2' => 'Event Type2',
            'event_type2_code' => 'Event Type2 Code',
            'event_type3' => 'Event Type3',
            'event_type3_code' => 'Event Type3 Code',
            'unit_name' => 'Unit Name',
            'unit_name_code' => 'Unit Name Code',
            'images' => 'Images',
            'created_at' => 'Created At',
            'path' => 'Path',
            'batch_code' => 'Batch Code',
        ];
    }
}
